package com.personal.gateway.flinkAllCommand.flinkFileSystem;

import com.personal.gateway.custom.customEnum.flinkCommandEnum.FlinkFileSystemEnum;
import com.personal.gateway.flinkAllCommand.configurationOption.ConfigurationOption;
import com.personal.gateway.flinkAllCommand.configurationOption.ConfigurationOptionBuilder;
import com.personal.gateway.flinkAllCommand.configurationOption.KeyIndexInfomationDao;
import com.personal.gateway.flinkAllCommand.configurationOption.configurationGenerator.ConfigurationGeneratorString;
import com.personal.gateway.flinkAllCommand.configurationOption.configurationType.ConfigurationTypeString;
import com.personal.gateway.flinkAllCommand.configurationOption.parameterCheck.ParameterCheckString;
import com.personal.gateway.flinkAllCommand.configurationOption.webObjectGenerator.WebObjectGeneratorString;

import static com.personal.gateway.custom.customEnum.flinkCommandEnum.FlinkFileSystemEnum.ALIYUN_OSS;
import static com.personal.gateway.flinkAllCommand.FlinkExecuteCommand.FILE_SYSTEM_CONFIG;

/**
 * @author BigHead
 * @date 2022/1/21 15:02
 * @description AliYunOss
 */
public class AliYunOss extends FlinkFileSystemTypeClass {

    private final ConfigurationOption<String, ConfigurationTypeString> OSS_ENDPOINT = ConfigurationOptionBuilder
            .startBuilder(FILE_SYSTEM_CONFIG, new KeyIndexInfomationDao("OSS_ENDPOINT", 2))
            .webShowName("OSS入口地址")
            .describe("连接OSS的地址")
            .typeString()
            .setExampleValue("oss-cn-zhangjiakou-internal.aliyuncs.com")
            .webObjectGenerator(WebObjectGeneratorString.class)
            .parameterCheck(ParameterCheckString.class)
            .configurationGenerator(ConfigurationGeneratorString.class)
            .build();
    private final ConfigurationOption<String, ConfigurationTypeString> OSS_ACCESS_KEY_ID = ConfigurationOptionBuilder
            .startBuilder(FILE_SYSTEM_CONFIG, new KeyIndexInfomationDao("OSS_ACCESS_KEY_ID", 3))
            .webShowName("权限ID")
            .describe("连接OSS的权限ID")
            .typeString()
            .webObjectGenerator(WebObjectGeneratorString.class)
            .parameterCheck(ParameterCheckString.class)
            .configurationGenerator(ConfigurationGeneratorString.class)
            .build();
    private final ConfigurationOption<String, ConfigurationTypeString> OSS_ACCESS_KEY_SECRET = ConfigurationOptionBuilder
            .startBuilder(FILE_SYSTEM_CONFIG, new KeyIndexInfomationDao("OSS_ACCESS_KEY_SECRET", 4))
            .webShowName("权限密钥")
            .describe("连接OSS的权限密钥")
            .typeString()
            .webObjectGenerator(WebObjectGeneratorString.class)
            .parameterCheck(ParameterCheckString.class)
            .configurationGenerator(ConfigurationGeneratorString.class)
            .build();

    @Override
    protected FlinkFileSystemEnum[] setFlinkFileSystemEnums() {
        return new FlinkFileSystemEnum[]{ALIYUN_OSS};
    }
}
